﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpWeb
{
    /// <summary>
    /// 按钮标签
    /// </summary>
    public class ButtonTag : ContainerTagComponent
    {
        public ButtonTag()
        {
            this.type = ButtonTagType.button;
        }

        protected override string TagName
        {
            get { return "button"; }
        }
        /// <summary>
        /// 按钮类型
        /// </summary>
        public ButtonTagType type
        {
            get { return (ButtonTagType)Enum.Parse(typeof(ButtonTagType), this.Attributes["type"]); }
            set { this.Attributes["type"] = Enum.GetName(typeof(ButtonTagType), value); }
        }

        /// <summary>
        /// 当 button 元素加载时禁用此元素。
        /// </summary>
        public string disabled
        {
            get { return this.Attributes["disabled"]; }
            set { this.Attributes["disabled"] = value; }
        }

        /// <summary>
        /// 按钮的初始值
        /// </summary>
        public string value
        {
            get { return this.Attributes["value"]; }
            set { this.Attributes["value"] = value; }
        }

    }

    public enum ButtonTagType
    {
        button,
        reset,
        submit
    }
}
